package joney.model;

import java.util.Vector;

public class Account {

	private Vector<Expense> expenses;
	private String name;
	private double amount =0;
	private double startingAmount=0;
	
	public Account(String name)
	{
		this.name = name;
		expenses = new Vector<Expense>();
	}
	
	public Account(String name, double startingAmount)
	{
		this(name);
		this.startingAmount = startingAmount;
	}
	
	public Vector<Expense> getExpenses()
	{
		return expenses;
	}
	
	public void addExpense(Expense e)
	{
		e.setAssociatedAccount(this);
		expenses.add(e);
		amount+=e.getAmount();
	}
	
	public void removeExpense(Expense e)
	{
		expenses.remove(e);
		amount-=e.getAmount();
	}
	
	public boolean containsExpense(Expense e)
	{
		return expenses.contains(e);
	}
	
	public double getAmount()
	{
		return amount;
	}
	
	public double getStartingAmount()
	{
		return startingAmount;
	}
	
	public void addStartingAmount(double amount)
	{
		this.startingAmount+=amount;
	}
	
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
}
